#include<stdio.h>
#include<stdlib.h>
#define Max 100
typedef int ElementType;
typedef int Position;
typedef struct SNode *ProToSNode;
struct SNode{
	ElementType *Data;
	Position Top;
	int MaxSize;
};
typedef ProToSNode Stack;

Stack CreateStack(int MaxSize){
	Stack S=(Stack)malloc(sizeof(struct SNode));
	S->Data=(ElementType *)malloc(MaxSize*sizeof(ElementType));
	S->Top=-1;
	S->MaxSize=MaxSize;
	return S;
} 
bool IsFull(Stack S){
	return(S->Top==S->MaxSize-1);
}

bool Push(Stack S,ElementType X){
	if(IsFull(S)){
		return false; 
	}else{
		S->Data[++(S->Top)]=X;
		return true;
	}
}

bool IsEmpty(Stack S){
	return(S->Top==-1);
}

bool Pop(Stack S){
	if(IsEmpty(S)){
		return false; 
	}
	else{
		(S->Top)--;
		return true;
	}
}

void Clear(Stack S){
	while(!IsEmpty(S))Pop(S);
}
int main(){
	int N,M,i,p;
	char str[Max];
	scanf("%d %d",&N,&M);
	Stack S=CreateStack(M);
	for(i=0;i<N;i++){
		scanf("%s",str);
		Clear(S);
		for(p=0;str[p]!='\0';p++){
			if((str[p]=='S')&&(!Push(S,1)))break;
			if((str[p]=='X')&&(!Pop(S)))break;
		}
		if((str[p]=='\0')&&IsEmpty(S))printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}
